package battleship;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;

/**
 *
 * @author kamil
 */
@SuppressWarnings("serial")
public class Board extends JPanel {

	MainFrame parentLink;

	public Board(MainFrame parent) {
		super();
		this.parentLink = parent;
		
		setLayout(null);
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);

		Graphics2D g2d = (Graphics2D) g;

		// jakies opcje, zeby ladnie bylo
//		RenderingHints rh =
//				new RenderingHints(RenderingHints.KEY_ANTIALIASING,
//				RenderingHints.VALUE_ANTIALIAS_ON);
//		rh.put(RenderingHints.KEY_RENDERING,
//				RenderingHints.VALUE_RENDER_QUALITY);
//		g2d.setRenderingHints(rh);

		Dimension dim = getSize();

		switch (parentLink.gamePhase) {
			case CREATING_PLAYER1:
			case CREATING_PLAYER2:
			case PLAYING_PLAYER1:
			case PLAYING_PLAYER2:
			case CHANGING_PLAYER:
			case GAME_END:
				g2d.setColor(Color.BLUE);
				g2d.fillRect(0, 0, dim.width, dim.height);
				break;
			default:
				drawLogo(g2d);
				break;
		}
	}

	protected void drawLogo(Graphics2D g2d) {
	}
}
